/*
 * Copyright 2018 the original author or authors.
 * 
 * you can use the file or import project.but Do not take legal responsibility.
 * Only for learning communication.
 *
 * Java compiled version 1.8 or higher
 * 
 * 
 * 
 * 
 */
 
package org.demo.util.bean;

import java.util.HashMap;
import java.util.Map;

public class ExaHttpDownConfig {
	
	private int readTimeout = 5000;//设置读取超时时间，单位毫秒默认5秒
	private int connectTimeout = 5000;//设置链接超时时间，单位毫秒默认5秒
	
	private boolean isProxy=false;//是否为代理
	private String proxyIp;//代理ip
	private int proxyPort;//代理端口
	
	private Map<String,String> requestPros = new HashMap<String,String>();//设置请求头信息
	
	/**
	 * 设置代理
	 * @param proxyIp 代理ip
	 * @param proxyPort 代理端口
	 */
	public void setProxy(String proxyIp,int proxyPort) {
		this.isProxy = true;
		this.proxyIp = proxyIp;
		this.proxyPort = proxyPort;
	}

	public void clearRequestPros() {
		requestPros.clear();
	}
	
	public ExaHttpDownConfig addRequestPro(String key,String value) {
		requestPros.put(key, value);
		return this;
	}
	
	public int getReadTimeout() {
		return readTimeout;
	}

	public void setReadTimeout(int readTimeout) {
		this.readTimeout = readTimeout;
	}

	public int getConnectTimeout() {
		return connectTimeout;
	}

	public void setConnectTimeout(int connectTimeout) {
		this.connectTimeout = connectTimeout;
	}

	public boolean isProxy() {
		return isProxy;
	}

	public String getProxyIp() {
		return proxyIp;
	}

	public int getProxyPort() {
		return proxyPort;
	}

	public Map<String, String> getRequestPros() {
		return requestPros;
	}

	public void setRequestPros(Map<String, String> requestPros) {
		this.requestPros = requestPros;
	}
	
}
